package dyyx;

import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;

import dyyx.dto.Data1;
import dyyx.dto.Department;
import dyyx.dto.Pet;
import dyyx.dto.User;

public abstract class DataUtil {
	
	
	public static Department getDepartment(){
		Department dept = new Department();
		dept.id = 1;
		dept.name = "Department1";
		
		dept.users = getUsers();
		
		return dept;	
	}
	
	
	public static List<User> getUsers(){
		List<User> list = new ArrayList<>();
		
		User user = new User();
		user.id = 1;
		user.name = "cat";
		list.add(user);
		
		user = new User();
		user.id = 2;
		user.name = "tiger";
		list.add(user);
		
		return list;
	}

	public static Map<String,Object> getDataMap(){
		Map<String,Object> map = new HashMap<String,Object>();
		
		Map<String,Object> row1 = new HashMap<String,Object>();
		
		Map<String,Double> sum0 = new TreeMap<String,Double>();
		sum0.put("a", 3.0);
		sum0.put("b", 7.0);
		row1.put("sum0", sum0);
		
		Map<String,Long> count0 = new TreeMap<String,Long>();
		count0.put("a", 3L);
		count0.put("b", 7L);
		row1.put("count0", count0);
		
		Map<String,List<Double>> avg0 = new TreeMap<String,List<Double>>();
		
		List<Double> list1 = new  ArrayList<Double>();
		list1.add(10.0);
		list1.add(2.0);
		
		List<Double> list2 = new  ArrayList<Double>();
		list2.add(20.0);
		list2.add(3.0);

		avg0.put("a", list1);
		avg0.put("b", list2);
		row1.put("avg0", avg0);	
		
		Pet pet1 = new Pet("tiger",1,new Date());
		
		
		row1.put("pet", pet1);	
		
		Pet pet2 = new Pet("cat",2,new Date());
		List<Pet> pets = new ArrayList<Pet>();
		pets.add(pet1);
		pets.add(pet2);
		
		row1.put("pets", pets);	

		
		map.put("row1", row1);
		
		return map;
	}
	
	public static Data1 getData1(){
		Data1 data = new Data1();
		data.str1 = "hello";
		data.int1 = 1;
		data.int2 = 2;
		data.long1 = 3L;
		data.long2 = 4L;
		data.double1 = 5.1;
		data.double2 = 6.1;
		data.bool1 = true;
		data.bool2 = true;
		data.date1 = new Date();
		
		Map<String,Long> map1 = new HashMap<>();
		map1.put("a", 1L);
		map1.put("b", 2L);
		data.map1 = map1;
		
		Pet pet = new Pet("tiger",3,new Date());
		
		Map<String,Pet> map2 = new HashMap<>();
		map2.put("tiger", pet);
		
		Map<String,Map<String,Pet>> map3 = new HashMap();
		map3.put("data", map2);
		
		data.map2 = map2;
		data.map3 = map3;
		

		List<String> list1 = new ArrayList<>();
		list1.add("a");
		list1.add("b");


		List<Pet> list2 = new ArrayList<>();
		
		list2.add(pet);
		
		List<Map<String,Pet>> list3 = new ArrayList<>();
		
		list3.add(map2);
		
		data.list1 = list1;
		data.list2 = list2;
		data.list3 = list3;



		
		
		return data;
	}
	

}
